<?php

Yii::import('zii.widgets.CPortlet');

class TagCloud extends CPortlet
{
	public $title='Tag Clouds';
	public $maxTags=20;

	protected function renderContent()
	{
		$arr = array("baby", "life","singapore","soccer");
		$tags=Tag::model()->findTagWeights($this->maxTags);
		foreach($tags as $tag=>$weight)
		{
			if( Yii::app()->user->isGuest){
				$key = array_search(strtolower($tag), array_map('strtolower',$arr));
				if(is_numeric($key)){	
					continue;
				}
			}
			
			$weight=$weight * 2;
			$link=CHtml::link(CHtml::encode($tag), array('post/index','tag'=>$tag));
			echo CHtml::tag('span', array(
				'class'=>'span0',
				'style'=>"font-size:{$weight}pt",
			), $link)."\n";
		}
	}
}
